		var cityData= new Array();
		var addrData = new Array();
		var provinceId = 0;
		var cityId = 0;
		var countyId = 0;
		
		$(document).ready(function(){
			
			$.ajax({
				"type": "POST",
				"url" : "../common/areaChoose",
				"dataType" : "json",
				"async":false,
				"data" : {
					areaId : "0",
				},
				"success":function(data){
					var province=data.data;
					console.log(data)
					for ( var i in province) {
						var provinceName=province[i].name;
						var provinceId=province[i].id;
						var citys= new Array();
						
						$.ajax({
							"type": "POST",
							"url" : "../common/areaChoose",
							"dataType" : "json",
							"async":false,
							"data" : {
								areaId : provinceId,
							},
							"success":function(data){
								var city=data.data;
								for ( var j in city) {
									var cityName=city[j].name;
									var cityId=city[j].id;
									citys.push({"code":cityId,"name":cityName,"sort":j})
								}	
							}	
						})
						cityData.push({"code":provinceId,"name":provinceName,"level":citys});
					}
				}	
			})
			
		    if ( typeof module != 'undefined' && module.exports ) {
		        module.exports = cityData;
		    } else {
		        window.cityData = cityData;
		    }
		})
		
		/*三级选择*/
		function picker() {
		    var cityName = document.getElementById('cityName');
		    var addrName = document.getElementById('addrName');
		    new Picker({
		        "title": '选择省市',//标题(可选)
		        "defaultValue": cityName.value,//默认值-多个以空格分开（可选）
		        "type": 2,//需要联动级数[1、2、3]（可选）
		        "data": cityData,//数据(必传)
		        "keys": {
		            "id": "code",
		            "value": "name",
		            "childData": "level"//最多3级联动
		        },//数组内的键名称(必传，id、text、data)
		        "callBack": function (val,id) {
		            //回调函数（val为选择的值）
		            console.log(id);
		            provinceId = id.split(',')[0];
		            cityId = id.split(',')[1];
		            f_load_addr(cityId);
		            cityName.innerHTML = val;
		            addrName.innerHTML = '选择区县街道';
		        }
		    });
		}
		
		$("#addrName").on("click",function(){
			if(cityId != 0){
				picker2();
			}
		})
		
		function f_load_addr(cityId){
			addrData = new Array();
			var areas= new Array();
			$.ajax({
				"type": "POST",
				"url" : "../common/areaChoose",
				"dataType" : "json",
				"async":false,
				"data" : {
					areaId : cityId,
				},
				"success":function(data){
					var area=data.data;
					var areaId = area.id;
					var areaName = area.areaName;
					for ( var k in area) {
						var areaName=area[k].name;
						var areaId=area[k].id;
						var addrs= new Array();
						
						$.ajax({
							"type": "POST",
							"url" : "../common/areaChoose",
							"dataType" : "json",
							"async":false,
							"data" : {
								areaId : areaId,
							},
							"success":function(data){
								var addr = data.data;
								for ( var j in addr) {
									var addrName=addr[j].name;
									var addrId=addr[j].id;
									
									addrs.push({"code":addrId,"name":addrName,"sort":j})
								}	
							}	
						})
						
						addrData.push({"code":areaId,"name":areaName,"level":addrs});
					}
					
				}	
			})
			
			if ( typeof module != 'undefined' && module.exports ) {
		        module.exports = addrData;
		    } else {
		        window.addrData = addrData;
		    } 
		}
		
		function picker2() {
			var addrName = document.getElementById('addrName');
		    new Picker({
		        "title": '选择区县街道',//标题(可选)
		        "type": 2,//需要联动级数[1、2、3]（可选）
		        "data": addrData,//数据(必传)
		        "keys": {
		            "id": "code",
		            "value": "name",
		            "childData": "level"//最多3级联动
		        },//数组内的键名称(必传，id、text、data)
		        "callBack": function (val,id) {
		            //回调函数（val为选择的值）
		             console.log(val,id);
		             countyId = id.split(',')[0];
		             addrName.innerHTML = val;
		        }
		    });
		}